package br.com.caelum.jdbc.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import br.com.caelum.jdbc.ConnectionFactory;

public class LoginDao extends ConnectionFactory {
	private Connection ex;
	private PreparedStatement ptmt;
	private ResultSet rs;
	
	public LoginDao(){
		this.ex = getConnection();
	}
	public boolean isAutentic(String usuario, String senha) throws SQLException{
        ptmt = ex.prepareStatement("SELECT * FROM USUARIO WHERE USUARIO = ? AND SENHA = ?");
        ptmt.setString(1, usuario);
        ptmt.setString(2, senha);
        rs = ptmt.executeQuery();
        return rs.next();
}
}